/*
Copyright (c) [2019年5月1日] [吴超]
[MBT_studio] is licensed under Mulan PSL v2.
You can use this software according to the terms and conditions of the Mulan PSL v2.
You may obtain a copy of Mulan PSL v2 at:
		 http://license.coscl.org.cn/MulanPSL2
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
See the Mulan PSL v2 for more details.
*/
#pragma once

#include "节点数据声明.h"
#include "节点/节点.h"
#include "节点/插座/C_物体插座.h"

#include <物体/物体.h>
#include <matXX.h>


void f_socket_resize物体插座数据(std::vector<S_物体*>& data, uint32 num);


class C_插座_物体Array1D : public C_插座基类 {
public:
	C_插座_物体Array1D(std::wstring name);
	~C_插座_物体Array1D();
	//vector<string>		m_ObjectNames;
	std::vector<S_物体*>	m_Value;


	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, uint8 线程ID = 0);
	void		f_setData(S_引用插座数据映射* data);
	std::wstring	f_getTypeName() { return L"[物体]"; }
	void			f_释放数据();
private:

};
#define DEF_物体Array1D插座(socket) dynamic_cast<C_插座_物体Array1D*>( (socket) )
#define DEF_物体插座_Array1D数据(socket, loc) ( (std::vector<S_物体*>*)(socket->f_getData(loc)) )

#define DEF_创建物体_Array1D插座_I(name)  socket = new C_插座_物体Array1D( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建物体_Array1D插座_O(name)  socket = new C_插座_物体Array1D( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);

void f_设置物体ID(std::vector<S_物体*>& 物体, std::vector<int32>& ID, uint32 偏移);
void f_设置物体ID(std::vector<S_物体*>& 物体, uint32 偏移);




class C_物体插座_1D : public C_插座基类 {
	S_OBArray* m_默认值;
	S_OBArray* m_转换值;
public:
	C_物体插座_1D(std::wstring name);
	~C_物体插座_1D();
	
	S_OBArray*   m_Value;

	void*        f_getData(uint8 线程ID);
	void         f_setData(void* data, uint8 线程ID = 0);
	bool		 f_接入插座是否匹配(E_值类型 type);
	std::wstring f_getTypeName() { return L"[OB]"; }
	
private:

};
#define DEF_物体1D插座(socket) dynamic_cast<C_物体插座_1D*>( (socket) )
#define DEF_物体插座_1D数据(socket, loc) ( (S_OBArray*)(socket->f_getData(loc)) )

#define DEF_创建物体_1D插座_I(name)  socket = new C_物体插座_1D( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建物体_1D插座_O(name)  socket = new C_物体插座_1D( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);









class C_插座_对象1D : public C_插座基类 {
public:
	C_插座_对象1D(std::wstring name);
	~C_插座_对象1D();
	//vector<string>		m_ObjectNames;
	std::vector<S_Object*>	m_Value;


	void*	f_getData(uint8 线程ID);
	void	f_setData(void* data, uint8 线程ID = 0);
	void	f_setData(S_引用插座数据映射* data);
	std::wstring		f_getTypeName() { return L"[OB]"; }
	void	f_释放数据();
private:

};
#define DEF_对象1D插座(socket) dynamic_cast<C_插座_对象1D*>( (socket) )
#define DEF_对象1D插座Value(socket) ( (std::vector<S_Object*>*)(socket->f_getData(0)) )

#define DEF_创建对象1D插座_I(name)  socket = new C_插座_对象1D( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建对象1D插座_O(name)  socket = new C_插座_对象1D( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);












class C_网格1D插座 : public C_插座基类 {
	S_MeshArray*          m_默认;
	S_MeshArray*          m_转换;
public:
	C_网格1D插座(std::wstring name);
	~C_网格1D插座();

	S_MeshArray*          m_Value;
	//std::vector<S_Mesh*>  m_Value;

	void*		f_getData(uint8 线程ID);
	void		f_setData(void* data, uint8 线程ID = 0);
	void		f_setData(S_引用插座数据映射* data);
	//void		f_setData(void* data, uint64 ID);
	std::wstring		f_getTypeName() { return L"[mesh]"; }
};

#define DEF_网格插座(socket)  dynamic_cast<C_网格1D插座*>( (socket) )
#define DEF_网格插座_1D数据(socket, tid)  ( (S_MeshArray*)((socket)->f_getData(tid)) )

#define DEF_创建网格_1D插座_I(name) socket = new C_网格1D插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建网格_1D插座_O(name) socket = new C_网格1D插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);







class C_骨骼1D插座 : public C_插座基类 {

public:
	C_骨骼1D插座(std::wstring name);
	~C_骨骼1D插座();

	std::vector<S_物体*>	m_Value;

	void*			f_getData(uint8 线程ID);
	void			f_setData(void* data, uint8 线程ID = 0);
	std::wstring	f_getTypeName() { return L"[bone]"; }
	void			f_释放数据();
};

#define DEF_骨骼_1D插座(socket)  dynamic_cast<C_骨骼1D插座*>( (socket) )
#define DEF_骨骼_1D数据(socket, offset)  ( (std::vector<S_物体*>*)((socket)->f_getData(offset)) )

#define DEF_创建骨骼_1D插座_I(name) socket = new C_骨骼1D插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输入);
#define DEF_创建骨骼_1D插座_O(name) socket = new C_骨骼1D插座( (name) ); f_add插座(socket, E_插座方向::e_插座Type_输出);





/*PyObject* f_构建PyArray1D网格数据(const std::vector<S_网格插座数据>& meshs);






class C_物体数据Array1D插座 : public C_插座基类 {
public:
	C_物体数据Array1D插座(std::string name);
	~C_物体数据Array1D插座();

	std::vector<S_物体附属数据*> m_Value;

	void*		f_getData();
	void		f_setData(void* data, int64 ID = -1);
	PyObject*	f_输出_bl数据(PyObject* bl_data = 0);
};
#define DEF_物体数据Array1D插座(socket) dynamic_cast<C_物体数据Array1D插座*>( (socket) )
#define DEF_物体数据Array1DValue(socket)  ((vector<S_物体附属数据*>*)socket->f_getData())

#define DEF_创建物体数据Array1D插座_I(name) socket = new C_物体数据Array1D插座( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输入);
#define DEF_创建物体数据Array1D插座_O(name) socket = new C_物体数据Array1D插座( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输出);





typedef struct {
	PyObject*	font;
	std::string		name;
}S_字体数据;

class C_字体插座_1D : public C_插座基类 {

public:
	C_字体插座_1D(std::string name);
	~C_字体插座_1D();

	std::vector<S_字体数据>	m_Value;

	void* f_getData();
	void		f_setData(void* data, int64 ID = -1);
	//void		f_setData(S_引用插座数据映射* data);
	//void		f_setData(void* data, uint64 ID);
	//void* f_getData(const uvec4& id);
	//uvec4		f_get维度();
	//void		f_resize(uint64 size);
	PyObject*	f_输出_bl数据(PyObject* bl_data = 0);
	//void		f_释放数据();
};

#define DEF_转换为字体1D插座(socket)  dynamic_cast<C_字体插座_1D*>( (socket) )
#define DEF_字体1D插座Value(socket)  ( (vector<S_字体数据>*)(DEF_转换为Array1d_Mesh插座((socket))->f_getData()) )

#define DEF_创建字体Array1D插座_I(name) socket = new C_字体插座_1D( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输入);
#define DEF_创建字体1D插座插座_O(name) socket = new C_字体插座_1D( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输出);













class C_平面集插座 : public C_插座基类 {

public:
	C_平面集插座(std::string name);
	~C_平面集插座();


	std::vector<S_平面属性>	m_平面属性集;

	void*			f_getData();
	void			f_setData(void* data, int64 ID = -1);

};

#define DEF_转换为集合物体Value(socket) dynamic_cast<vector<S_平面属性>*>( (socket) )
















typedef struct {
	PyObject*	mat;
	std::string		name;
}S_材质插座数据;

class C_材质插座_Array1D : public C_插座基类 {

public:
	C_材质插座_Array1D(std::string name);
	~C_材质插座_Array1D();

	std::vector<S_材质插座数据>	m_Value;

	void*		f_getData();
	void		f_setData(void* data, int64 ID = -1);
	
	PyObject*	f_bl_传入数据(PyObject* bl_data);
	PyObject*	f_输出_bl数据(PyObject* bl_data = 0);
	//void		f_释放数据();
};

#define DEF_转换为材质Array1D插座(socket)  dynamic_cast<C_材质插座_Array1D*>( (socket) )
#define DEF_材质Array1D插座Value(socket)  ( (vector<S_材质插座数据>*)(DEF_转换为材质Array1D插座((socket))->f_getData()) )

#define DEF_创建材质Array1D插座_I(name) socket = new C_材质插座_Array1D( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输入);
#define DEF_创建材质Array1D插座_O(name) socket = new C_材质插座_Array1D( (name) ); f_add插座(socket, E_插座输出方向::e_插座Type_输出);
*/





/*typedef struct {
	S_物理解算器*				解算器;
	vector<S_bl物理体对象包>	bodys;
}S_物理体集合对象包;*/


/*class C_物理体集插座 : public C_插座基类 {

public:
	C_物理体集插座(string name);
	~C_物理体集插座();

	vector<S_bl物理体对象包>	m_Value;

	void*			f_getData();
	void			f_setData(void* data, int64 ID = -1);

};
#define DEF_转换为物理体集合插座(socket) dynamic_cast<C_物理体集插座*>( (socket) )
#define DEF_转换为物理体集合Value(socket) (vector<S_bl物理体对象包>* )( (socket)->f_getData() )
*/


//#define DEF_转换为物理体集合Value(socket) (vector<S_bl物理体对象包>* )( (socket)->f_getData() )



